package com.qeado.content.dao.ibatis;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.qeado.common.dao.BaseDao;
import com.qeado.content.dao.AdManageDao;
import com.qeado.content.model.AdManage;
import com.qeado.content.model.AdTypeCode;

@Repository
@SuppressWarnings("unchecked")
public class AdManageDaoImpl extends BaseDao implements AdManageDao {

	public List<AdTypeCode> getAllAdTypeList() {
		return getSqlMapClientTemplate().queryForList("getAllAdType");
	}

	public List<AdManage> getAdByTypeAndDesc(AdManage ad) {
		return getSqlMapClientTemplate().queryForList("getAdByTypeAndDesc",ad);
	}

	@Override
	public void insertAdManage(AdManage ad) {
		getSqlMapClientTemplate().insert("insertAdManage", ad);
	}

	@Override
	public void updateAdManage(AdManage ad) {
		getSqlMapClientTemplate().update("updateAdManage", ad);
	}

	@Override
	public List<AdTypeCode> getAllAdLocationList() {
		return getSqlMapClientTemplate().queryForList("getAllAdLocation");
	}

	@Override
	public void deleteAdManageById(String id) {
		getSqlMapClientTemplate().delete("deleteAdManageById", id);
	}

	@Override
	public AdManage selectAdManageById(String id) {
		return (AdManage)getSqlMapClientTemplate().queryForObject("selectAdManageById", id);
	}

	@Override
	public AdManage getAdContent(String id) {
		return (AdManage)getSqlMapClientTemplate().queryForObject("getAdContent", id);
	}

}
